package com.springDemo.AOP.test;

import com.springDemo.AOP.proxy.PayDynamicProxyByJDK;
import com.springDemo.AOP.service.IPayApi;
import com.springDemo.AOP.service.PayApiImpl;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

/**
 * Created by Administrator on 2016/7/11.
 */
public class PayTestJDK {
    public static void main(String[] args) {
        InvocationHandler payHanler = new PayDynamicProxyByJDK(new PayApiImpl());
        IPayApi pay =  (IPayApi)Proxy.newProxyInstance(PayApiImpl.class.getClassLoader(),
                PayApiImpl.class.getInterfaces(),payHanler);
        pay.payByRMB( "KEN" );
    }
}
